package se19team1e.entity;

import se19team1e.dao.abstrakt.generics.DataTransferObject;
import se19team1e.util.ReflectionUtils;

/**
 * Represents a registered user account in the system.
 * 
 * @author Palaniappan Vairavan
 *
 */
@SuppressWarnings("serial")
public class AccountDTO implements DataTransferObject<AccountDTO> {

    /**
     * Account object id.
     */
    private String id;
    
    /**
     * Account login credentials.
     */
    private String username;
    
    /**
     * Account login password.
     */
    private String password;
    
    private boolean deleted;

    /**
     * Sets the new account object id.
     * @param id New account object id.
     */
    public void setId( String id ) {
        this.id = id;
    }

    /**
     * Gets the account login credentials.
     * @return Account login credentials.
     */
    public String getUsername() {
        return this.username;
    }

    /**
     * Sets the new account login credentials.
     * @param username New account login credentials.
     */
    public void setUsername( String username ) {
        this.username = username;
    }

    /**
     * Gets the account login password.
     * @return Account login password.
     */
    public String getPassword() {
        return this.password;
    }

    /**
     * Sets the new account login password.
     * @param password Account login password.
     */
    public void setPassword( String password ) {
        this.password = password;
    }

    /**
     * Validates the specified password with the account password.
     * 
     * @param password Password to validate against.
     * @return True if successful.
     */
    public boolean login( String password ) {
        return this.password.equals( password );
    }

    /**
     * Logs out this account.
     */
    public void logout() {
        // do nothing
    }
    
	@Override
	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}
	
	@Override
	public boolean isDeleted() {
		return deleted;
	}

	@Override
	public void setId(Object id) {
		this.id=(String) id;
	}
	
	@Override
	public String getId() {
		return id;
	}

	@Override
	public String toString() {
		return (ReflectionUtils.toString(this));
	}
}
